package com.example.demo.leetcode.top100;

/**
 * ******************************************************
 *
 * @author liugh9
 * @version 1.0
 * @classname _4移动零
 * @description
 * @date 2023/06/03 22:26
 * <p>
 * ******************************************************
 */
public class _4移动零 {

    public void moveZeroes(int[] nums) {
        int fast = 0;
        int slow = 0;

        while (fast < nums.length) {
            if (nums[fast] != 0) {
                nums[slow] = nums[fast];
                slow++;
            }
            fast++;
        }

        for (; slow < nums.length; slow++) {
            nums[slow] = 0;
        }
    }
}
